<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father{
            height: 1000px;
            width: 200px;
            background-color: aqua;
            position: relative;
        }
        .son{
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            height: 200px;
            width: 100px;
            background-color: black;
        }
    </style>
</head>
<body>
    <div class="father">
        <div class="son"></div>
    </div>
    <script>
        // 事件冒泡
        let father = document.querySelector('.father')
        let son = document.querySelector('.son')
        father.addEventListener('click', () => {
            alert('我是爸爸')
        })
        son.addEventListener('click', (e) => {
            alert('我是儿子')
            console.log(e);
            e.stopPropagation()
        })
    </script>
</body>
</html>